home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #12 / Amiga Plus CD - 2002 - No. 12.iso / Tools / Freeware / PerfectPaint / rexx / bridge / Anim_Text.rx < prev    next >
Encoding:
Text File  |  2001-12-03  |  7.6 KB  |  446 lines

  1. /*
  2.     Arexx Text Script
  3. */
  4.  
  5.     call addlib("rexxmathlib.library", 5, -30, 0)
  6.  
  7.     options results
  8.   parse ARG Port x y b
  9.     ADDRESS value Port
  10.  
  11.     pp_CountFrames
  12.     Total_Frame=result
  13.     Start_Frame=1
  14.     End_Frame=Total_Frame
  15.     if End_Frame<2 then do
  16.         pp_Warn 'Make*an*Anim*first.'
  17.         EXIT
  18.     end
  19.  
  20.     pp_GetDepth
  21.     Dp=result
  22.  
  23.     ADDRESS COMMAND
  24.  
  25.     file="T:pp_text"
  26.     IF OPEN('a',file,'R') then DO
  27.         trash=READLN('a')
  28.         trash=READLN('a')
  29.         Tsize=READLN('a')
  30.         Ttype=READLN('a')
  31.         trash=READLN('a')
  32.         trash=READLN('a')
  33.         trash=READLN('a')
  34.         trash=READLN('a')
  35.         Txdpi=READLN('a')
  36.         Tydpi=READLN('a')
  37.         Trot=READLN('a')
  38.         Tita=READLN('a')
  39.         trash=READLN('a')
  40.         trash=READLN('a')
  41.         trash=READLN('a')
  42.         trash=READLN('a')
  43.         trash=READLN('a')
  44.         trash=READLN('a')
  45.         Tw=READLN('a')
  46.         Th=READLN('a')
  47.         CALL CLOSE('a')
  48.  
  49.         Start_Rotation=Trot
  50.         End_Rotation=Trot
  51.  
  52.         Start_Italic=Tita
  53.         End_Italic=Tita
  54.  
  55.         Start_Size=Tsize
  56.         End_Size=Tsize
  57.  
  58.         Start_Xdpi=Txdpi
  59.         End_Xdpi=Txdpi
  60.  
  61.         Start_Ydpi=Tydpi
  62.         End_Ydpi=Tydpi
  63.  
  64.         Start_Flow=0
  65.         End_Flow=0
  66.  
  67.         Start_Opacity=100
  68.         End_Opacity=100
  69.     END
  70.     ELSE
  71.     DO
  72.         ADDRESS value Port
  73.         pp_Warn 'Make*a*Text*first.'
  74.         EXIT
  75.         ADDRESS COMMAND        
  76.     END
  77.  
  78.     file="T:pp_move"
  79.     IF OPEN('b',file,'R') then DO
  80.         Start_Rotation=READLN('b')
  81.         End_Rotation=READLN('b')
  82.  
  83.         Start_Italic=READLN('b')
  84.         End_Italic=READLN('b')
  85.  
  86.         Start_Size=READLN('b')
  87.         End_Size=READLN('b')
  88.  
  89.         Start_Xdpi=READLN('b')
  90.         End_Xdpi=READLN('b')
  91.  
  92.         Start_Ydpi=READLN('b')
  93.         End_Ydpi=READLN('b')
  94.  
  95.         Start_Flow=READLN('b')
  96.         End_Flow=READLN('b')
  97.  
  98.         Start_Opacity=READLN('b')
  99.         End_Opacity=READLN('b')
  100.  
  101.         CALL CLOSE('b')
  102.     END
  103.  
  104.     R=-1
  105.  
  106.     ADDRESS value Port
  107.  
  108.     Path=0;Type=0
  109.  
  110. DO UNTIL R>-1
  111.  
  112.     D.2='*Frame*(*#'||Start_Frame||'->#'||End_Frame||'*)*'
  113.  
  114.     D.3='*Rotation*(*'||Start_Rotation||'*->*'||End_Rotation||'*)*'
  115.     D.4='*Italic*(*'||Start_Italic||'*->*'||End_Italic||'*)*'
  116.     D.5='*Size*(*'||Start_Size||'*->*'||End_Size||'*)*'
  117.     D.6='*ScaleX*(*'||Start_Xdpi||'*->*'||End_Xdpi||'*)*'
  118.     D.7='*ScaleY*(*'||Start_Ydpi||'*->*'||End_Ydpi||'*)*'
  119.  
  120.     D.8='*Flow*(*'||Start_Flow||'*->*'||End_Flow||'*)*'
  121.     D.9='*Opacity*(*'||Start_Opacity||'*->*'||End_Opacity||'*)*'
  122.  
  123.     pp_DialogInit 250 270 "*MOVE*" 10
  124.     pp_Cycle 0 70 5 100 16 "Path" 1 "None|Left|Right|Up|Down" Path
  125.     pp_Cycle 1 70 25 100 16 "Type" 1 "In|Out" Type
  126.         j=55
  127.         DO i=2 to 9
  128.             pp_Button i 20 j 200 16 D.i
  129.             j=j+20
  130.             if i=2 then DO;j=j+10;END
  131.             if i=7 then DO;j=j+10;END
  132.         END
  133.     pp_Dialog
  134.     R=result
  135.  
  136.     pp_GetDialog 0
  137.     Path=result
  138.  
  139.     pp_GetDialog 1
  140.     Type=result
  141.  
  142.     if R=-9 then DO
  143.         pp_DialogInit 150 80 "*OPACITY*" 2
  144.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Opacity
  145.             pp_Integer 1 60 25 50 16 "End" 1 End_Opacity
  146.         pp_Dialog
  147.         rc=result
  148.         IF rc=1 then DO
  149.             pp_GetDialog 0
  150.             Start_Opacity=result
  151.  
  152.             pp_GetDialog 1
  153.             End_Opacity=result        
  154.         END            
  155.     END
  156.  
  157.     if R=-8 then DO
  158.         pp_DialogInit 150 80 "*FLOW*" 2
  159.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Flow
  160.             pp_Integer 1 60 25 50 16 "End" 1 End_Flow
  161.         pp_Dialog
  162.         rc=result
  163.         IF rc=1 then DO
  164.             pp_GetDialog 0
  165.             Start_Flow=result
  166.  
  167.             pp_GetDialog 1
  168.             End_Flow=result    
  169.         END            
  170.     END
  171.  
  172.     if R=-5 then DO
  173.         pp_DialogInit 150 80 "*SIZE*" 2
  174.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Size
  175.             pp_Integer 1 60 25 50 16 "End" 1 End_Size
  176.         pp_Dialog
  177.         rc=result
  178.         IF rc=1 then DO
  179.             pp_GetDialog 0
  180.             Start_Size=result
  181.  
  182.             pp_GetDialog 1
  183.             End_Size=result        
  184.         END            
  185.     END
  186.  
  187.     if R=-6 then DO
  188.         pp_DialogInit 150 80 "*SCALE*X*" 2
  189.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Xdpi
  190.             pp_Integer 1 60 25 50 16 "End" 1 End_Xdpi
  191.         pp_Dialog
  192.         rc=result
  193.         IF rc=1 then DO
  194.             pp_GetDialog 0
  195.             Start_Xdpi=result
  196.  
  197.             pp_GetDialog 1
  198.             End_Xdpi=result        
  199.         END            
  200.     END
  201.  
  202.     if R=-7 then DO
  203.         pp_DialogInit 150 80 "*SCALE*Y*" 2
  204.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Ydpi
  205.             pp_Integer 1 60 25 50 16 "End" 1 End_Ydpi
  206.         pp_Dialog
  207.         rc=result
  208.         IF rc=1 then DO
  209.             pp_GetDialog 0
  210.             Start_Ydpi=result
  211.  
  212.             pp_GetDialog 1
  213.             End_Ydpi=result        
  214.         END            
  215.     END
  216.  
  217.     if R=-2 then DO
  218.         pp_DialogInit 150 80 "*FRAME*" 2
  219.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Frame
  220.             pp_Integer 1 60 25 50 16 "End" 1 End_Frame
  221.         pp_Dialog
  222.         rc=result
  223.         IF rc=1 then DO
  224.             pp_GetDialog 0
  225.             Start_Frame=result
  226.  
  227.             pp_GetDialog 1
  228.             End_Frame=result
  229.  
  230.             IF End_Frame>Total_Frame THEN DO
  231.                 End_Frame=Total_Frame
  232.             END
  233.  
  234.             IF Start_Frame>End_Frame THEN DO
  235.                 Start_Frame=1
  236.             END
  237.  
  238.         END            
  239.     END
  240.  
  241.     if R=-3 then DO
  242.         pp_DialogInit 150 80 "*ROTATION*" 2
  243.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Rotation
  244.             pp_Integer 1 60 25 50 16 "End" 1 End_Rotation
  245.         pp_Dialog
  246.         rc=result
  247.         IF rc=1 then DO
  248.             pp_GetDialog 0
  249.             Start_Rotation=result
  250.  
  251.             pp_GetDialog 1
  252.             End_Rotation=result        
  253.         END            
  254.     END
  255.  
  256.     if R=-4 then DO
  257.         pp_DialogInit 150 80 "*ITALIC*" 2
  258.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Italic
  259.             pp_Integer 1 60 25 50 16 "End" 1 End_Italic
  260.         pp_Dialog
  261.         rc=result
  262.         IF rc=1 then DO
  263.  
  264.             pp_GetDialog 0
  265.             Start_Italic=result
  266.             IF Start_Italic>45 then DO
  267.                 Start_Italic=45
  268.             END
  269.             IF Start_Italic<-45 then DO
  270.                 Start_Italic=-45
  271.             END
  272.  
  273.             pp_GetDialog 1
  274.             End_Italic=result    
  275.             IF End_Italic>45 then DO
  276.                 End_Italic=45
  277.             END
  278.             IF End_Italic<-45 then DO
  279.                 End_Italic=-45
  280.             END
  281.  
  282.         END            
  283.     END
  284. END
  285.  
  286.     if R=0 then DO
  287.         EXIT
  288.     END    
  289.     
  290.     ADDRESS COMMAND
  291.  
  292.     file='t:pp_move'
  293.  
  294.     IF EXISTS(file) THEN DO
  295.         'delete >nil: t:pp_move'
  296.     END
  297.  
  298.     IF OPEN('c',file,'W') then DO
  299.  
  300.         CALL WRITELN('c',Start_Rotation)
  301.         CALL WRITELN('c',End_Rotation)
  302.  
  303.         CALL WRITELN('c',Start_Italic)
  304.         CALL WRITELN('c',End_Italic)
  305.  
  306.         CALL WRITELN('c',Start_Size)
  307.         CALL WRITELN('c',End_Size)
  308.  
  309.         CALL WRITELN('c',Start_Xdpi)
  310.         CALL WRITELN('c',End_Xdpi)
  311.  
  312.         CALL WRITELN('c',Start_Ydpi)
  313.         CALL WRITELN('c',End_Ydpi)
  314.  
  315.         CALL WRITELN('c',Start_Flow)
  316.         CALL WRITELN('c',End_Flow)
  317.  
  318.         CALL WRITELN('c',Start_Opacity)
  319.         CALL WRITELN('c',End_Opacity)
  320.  
  321.         CALL CLOSE('c')
  322.     END
  323.  
  324.     ADDRESS value Port
  325.  
  326.     pp_GetWidth
  327.     W=result
  328.  
  329.     pp_GetHeight
  330.     H=result
  331.  
  332.     HX=Tw/2
  333.     HY=Th/2
  334.  
  335.     Start_X=x
  336.     End_X=x
  337.     Start_Y=y
  338.     End_Y=y
  339.  
  340.     IF Path=1 then DO
  341.         IF Type=0 then DO
  342.             Start_X=HX*-1
  343.         END
  344.         ELSE
  345.         DO
  346.             End_X=HX*-1
  347.         END
  348.     END
  349.  
  350.     IF Path=2 then DO
  351.         IF Type=0 then DO
  352.             Start_X=W+HX
  353.         END
  354.         ELSE
  355.         DO
  356.             End_X=W+HX
  357.         END
  358.     END
  359.  
  360.     IF Path=3 then DO
  361.         IF Type=0 then DO
  362.             Start_Y=HY*-1
  363.         END
  364.         ELSE
  365.         DO
  366.             End_Y=HY*-1
  367.         END
  368.     END
  369.  
  370.     IF Path=4 then DO
  371.         IF Type=0 then DO
  372.             Start_Y=H+HY
  373.         END
  374.         ELSE
  375.         DO
  376.             End_Y=H+HY
  377.         END
  378.     END
  379.  
  380.     step=(End_Frame-Start_Frame)
  381.  
  382.     Step_Rotation=(End_Rotation-Start_Rotation)/Step
  383.     Step_Italic=(End_Italic-Start_Italic)/Step
  384.     Step_Xdpi=(End_Xdpi-Start_Xdpi)/Step
  385.     Step_Ydpi=(End_Ydpi-Start_Ydpi)/Step
  386.     Step_Size=(End_Size-Start_Size)/Step
  387.  
  388.     Step_Flow=(End_Flow-Start_Flow)/Step
  389.     Step_Opacity=(End_Opacity-Start_Opacity)/Step
  390.  
  391.     Step_X=(End_X-Start_X)/Step
  392.     Step_Y=(End_Y-Start_Y)/Step
  393.     
  394.  
  395.     pp_Progresstext 'Move*Text'
  396.     DO i=Start_Frame to End_Frame
  397.         pp_Progress (i-Start_Frame) (End_Frame-Start_Frame+1)
  398.  
  399.         pp_GotoFrame i
  400.  
  401.         Rotation=trunc(Start_Rotation+Step_Rotation*(i-Start_Frame)+0.5,0)
  402.         Italic=trunc(Start_Italic+Step_Italic*(i-Start_Frame)+0.5,0)
  403.         Xdpi=trunc(Start_Xdpi+Step_Xdpi*(i-Start_Frame)+0.5,0)
  404.         Ydpi=trunc(Start_Ydpi+Step_Ydpi*(i-Start_Frame)+0.5,0)
  405.         Size=trunc(Start_Size+Step_Size*(i-Start_Frame)+0.5,0)
  406.         
  407.         Flow=trunc(Start_Flow+Step_Flow*(i-Start_Frame)+0.5,0)
  408.         Opacity=trunc(Start_Opacity+Step_Opacity*(i-Start_Frame)+0.5,0)
  409.  
  410.         X=trunc(Start_X+Step_X*(i-Start_Frame)+0.5,0)
  411.         Y=trunc(Start_Y+Step_Y*(i-Start_Frame)+0.5,0)
  412.         
  413.         IF Flow>3 then DO
  414.             pp_EffectOn
  415.             pp_AirBrush Opacity Flow
  416.         END
  417.         ELSE
  418.         IF Opacity<100 then DO
  419.             IF Dp=24 then DO
  420.                 pp_BrushOpacity Opacity
  421.             END
  422.             ELSE DO
  423.                 pp_EffectOn
  424.                 pp_Trans Opacity
  425.             END
  426.         END
  427.  
  428.         IF Opacity>0 then DO
  429.             pp_TextXDPI Xdpi
  430.             pp_TextYDPI Ydpi
  431.             pp_TextItalic Italic
  432.             pp_TextRotate Rotation
  433.             pp_TextSize Size
  434.             pp_TextMake
  435.             pp_TextDraw X Y
  436.         END
  437.  
  438.         pp_EffectOff
  439.  
  440.     END
  441.  
  442.     pp_GotoFrame Start_Frame
  443.     pp_TextRestore
  444.     pp_TextMake
  445.     pp_Progressclr
  446.